package com.flowerplus.store;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;

import com.flowerplus.store.common.structure.AppManager;


/**
 * Created by z on.
 * Des:
 * Date: 2017/5/9
 */

public class ActivityLifecycleCallback implements Application.ActivityLifecycleCallbacks {
    private static final String TAG = "ActivityLifecycleCallback";
    // 0的时候说明没有再前台
    public static int count = 0;

    @Override
    public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
        AppManager.getAppManager().addActivity(activity);
    }

    @Override
    public void onActivityStarted(Activity activity) {
        count++;
    }

    @Override
    public void onActivityResumed(Activity activity) {
    }

    @Override
    public void onActivityPaused(Activity activity) {
    }

    @Override
    public void onActivityStopped(Activity activity) {
        count--;
    }

    @Override
    public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
    }

    @Override
    public void onActivityDestroyed(Activity activity) {
        AppManager.getAppManager().removeActivity(activity);
    }
}
